package com.hn658.base.message.eventbus.event;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.hn658.base.message.common.enums.EventPriority;
import com.hn658.base.message.common.enums.EventType;
import com.hn658.framework.shared.entity.BaseEntity;
import com.hn658.framework.shared.utils.UUIDUtils;

/**
 * Created by baihai on 2015/11/19.
 */
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
public class Event extends BaseEntity {


    /**
	 * 
	 */
	private static final long serialVersionUID = 3390762743707946885L;

	/**
     * 消息Id
     */
    private String eventId;

    /**
     * 事件类型
     */
    private EventType type;

    /**
     * 事件处理优先级
     */
    private EventPriority priority;

    /**
     * 应用id
     */
    private String appId;

    /**
     * 是否需要保存
     * @return
     */
    private Boolean isNeedSave;
    
    /**
     * 是否离线发送
     */
    private Boolean isOfflineSend;

    public Event(){}

    public Event(EventType type, EventPriority priority,String appId){

        this.eventId = UUIDUtils.getUUID();
        this.type = type;
        this.priority = priority;
        this.appId = appId;

    }

	public String getEventId() {
        return eventId;
    }

    public void setEventId(String eventId) {
        this.eventId = eventId;
    }

    public EventType getType() {
        return type;
    }

    public void setType(EventType type) {
        this.type = type;
    }

    public EventPriority getPriority() {
        return priority;
    }

    public void setPriority(EventPriority priority) {
        this.priority = priority;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

	public Boolean getIsNeedSave() {
		if(isNeedSave==null){
			return true;
		}
		return isNeedSave;
	}

	public void setIsNeedSave(Boolean isNeedSave) {
		this.isNeedSave = isNeedSave;
	}

	public Boolean getIsOfflineSend() {
		if(isOfflineSend==null){
			return true;
		}
		return isOfflineSend;
	}

	public void setIsOfflineSend(Boolean isOfflineSend) {
		this.isOfflineSend = isOfflineSend;
	}

}
